package com.jerry.common.vo;

import com.jerry.common.ResultStatus;

/**
 * Filename:    ResultModel
 * Description:
 * Copyright:   Copyright (c)2016
 * Company:     lngtop
 *
 * @author: 谢余锋
 * @version: 1.0
 * Create at:   2016/7/8 13:21
 * <p/>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2016/7/8      谢余锋        1.0        1.0 Version
 */
public class ResultModel {

    private int code;
    private String message;
    private Object content;

    public ResultModel(int code, String message) {
        this.code = code;
        this.message = message;
        this.content = "";
    }

    public ResultModel(int code, String message, Object content) {
        this.code = code;
        this.message = message;
        this.content = content;
    }

    public ResultModel(ResultStatus status) {
        this.code = status.getCode();
        this.message = status.getMessage();
        this.content = "";
    }

    public ResultModel(ResultStatus status, Object content) {
        this.code = status.getCode();
        this.message = status.getMessage();
        this.content = content;
    }

    public static ResultModel success() {
        return new ResultModel(ResultStatus.SUCCESS);
    }

    public static ResultModel success(ResultStatus success) {
        return new ResultModel(success);
    }

    public static ResultModel success(String message) {
        return new ResultModel(ResultStatus.SUCCESS, message);
    }

    public static ResultModel success(Object content) {
        return new ResultModel(ResultStatus.SUCCESS, content);
    }

    public static ResultModel error(ResultStatus error) {
        return new ResultModel(error);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getContent() {
        return content;
    }

    public void setContent(Object content) {
        this.content = content;
    }
}
